package com.yc.controller;

import com.yc.bean.RepliesBean;
import com.yc.bean.ReviewBean;
import com.yc.bean.UserBean;
import com.yc.model.ResponseResult;
import com.yc.service.ReviewBiz;
import com.yc.service.UserBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zwei
 * @create 2024-10-07 18:37
 */
@RestController
@RequestMapping("/fooddetail")
public class FoodReviewController {
    private final ReviewBiz reviewBiz;
    private final UserBiz userBiz;
    @Autowired
    public FoodReviewController(ReviewBiz reviewBiz, UserBiz userBiz) {
        this.reviewBiz = reviewBiz;
        this.userBiz = userBiz;
    }
    @PostMapping("/getreview/{foodid}")
    public ResponseResult getreview(@PathVariable Integer foodid){
        List<ReviewBean> list=reviewBiz.getreview(foodid);
        return ResponseResult.ok().setData(list);
    }
    @GetMapping("/getReplies")
    public ResponseResult getReplies(){
        List<RepliesBean>list=reviewBiz.getReplies();
        return ResponseResult.ok().setData(list);
    }
    @GetMapping("/getuser")
    public ResponseResult getuser(){
        List<UserBean>list=userBiz.getuser();
        return ResponseResult.ok().setData(list);
    }
}
